using System;
using System.Text;
using Microsoft.Practices.RecipeFramework;
using Microsoft.Practices.ComponentModel;
using EnvDTE;

namespace SPALM.SharePointSoftwareFactory.Library.ValueProviders
{
    /// <summary>
    /// Searches in the current project for a folder which is mapped to "{SharePointRoot}"
    /// </summary>
    [ServiceDependency(typeof(DTE))]
    public class MappedRootFolderProvider : ValueProvider
    {
        public override bool OnBeginRecipe(object currentValue, out object newValue)
        {
            if (currentValue != null)
            {
                newValue = null;
                return false;
            }

            DTE service = (DTE)this.GetService(typeof(DTE));
            
            Project project = Helpers.GetSelectedProject(service);
            
            newValue = "12";
            return true;
        }        
    }
}
